//返回多个数据

public class ArrayList {

    public class Phone {
        private String brand;
        private int price;

        public Phone() {
        }

        public Phone(String brand, int price) {
            this.brand = brand;
            this.price = price;
        }

        public String getbrand() {
            return brand;
        }

        public void setbrand() {
            this.brand = brand;
        }

        public int getprice() {
            return price;
        }

        public void setprice(int price) {
            this.price = price;
        }
    }

    public static void main(String[] args) {
        ArrayList<Phone> list = new ArrayList();
        Phone p1 = new Phone("mi", 1000);
        Phone p2 = new Phone("hua", 2999);
        Phone p3 = new Phone("apple", 8999);
        list.add(p1);
        list.add(p2);
        list.add(p3);

        ArrayList<Phone> phoneinfoList = getphoneinfo(list);
        for (int i = 0; i < phoneinfolist.size(); i++) {
            Phone phone = phoneinfoList.get(i);
            System.out.println(phone.getbrand() + "," + phone.getprice());
        }

    }
    // 定义一个方法 把价格低于三千的手机返回

    // 技巧：若要返回多个数据，可以把这些数据先放到一个容器当中，再把容器返回

    public static void getphoneinfo(ArrayList<phone> list){
    ArrayList<Phone> resultlist=new ArrayList();
    //用于存储价格低于三千手机对象
    for(int i=0;i<list.size();i++){
    Phone p=new phone();
    p.getprice;
    if(preice<3000){
        resultlist.add(p);
    }
   }
   return resultlist;

}

}